package com.zhuss.core.db.dao.ext;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.core.query.Criteria;
import org.springframework.data.elasticsearch.core.query.CriteriaQuery;
import org.springframework.data.elasticsearch.core.query.IndexQuery;
import org.springframework.data.elasticsearch.core.query.IndexQueryBuilder;
import org.springframework.stereotype.Component;

import com.zhuss.bean.bo.core.orign.SearchOrignBo;
import com.zhuss.bean.vo.core.orign.DetailOrignVo;
import com.zhuss.bean.vo.core.orign.ListOrignVo;
import com.zhuss.core.db.dao.gen.OrignMapper;
import com.zhuss.core.db.entity.Orign;

@Component
public class OrignDao extends OrignMapper {
	
	@Autowired
	private ElasticsearchTemplate elasticsearchTemplate;
	
	public void create(Orign record) {
		IndexQuery indexQuery = new IndexQueryBuilder().withObject(record).withType("type").withIndexName("orign").build();
		elasticsearchTemplate.index(indexQuery);
	}
	
	public void delete(Orign record) {
		
	}
	
	public List<Orign> listAll() {
		List<Orign> result = elasticsearchTemplate.queryForList(new CriteriaQuery(new Criteria()), Orign.class);
		return result;
	}

	public List<ListOrignVo> list(SearchOrignBo bo) {
		return null;
	}

	public Integer countList(SearchOrignBo bo) {
		return 0;
	}

	public DetailOrignVo detail(@Param("orignId") Long orignId) {
		return null;
	}
	
    
}